//
//  UIButton+Extension.swift
//  Weibo1
//
//  Created by apple on 15/12/26.
//  Copyright © 2015年 idcast. All rights reserved.
//

import UIKit

extension UIButton {
    
    ///便利构造函数
    convenience init(imageName: String, backImageName: String) {
    
        self.init()
    
    setImage(UIImage(named: imageName), forState: UIControlState.Normal)
    setImage(UIImage(named: imageName + "_highlighted"), forState: UIControlState.Highlighted)
    setBackgroundImage(UIImage(named: backImageName), forState: UIControlState.Normal)
    setBackgroundImage(UIImage(named: backImageName + "_highlighted"), forState: UIControlState.Highlighted)
    sizeToFit()
    }
    
    ///便利构造函数
    convenience init(title: String, color: UIColor, imageName: String) {
    
        self.init()
        
        setTitle(title, forState: .Normal)
        setTitleColor(color, forState: .Normal)
        
        setBackgroundImage(UIImage(named: imageName), forState: .Normal)


    }

    
}

